<template>
  <div
    style="padding: 20px 30px 0;background-color: rgb(240, 242, 245);"
    v-if="list"
  >
    <el-row :gutter="30" class="panel-group">
      <el-col :span="12" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-description">
            <div class="card-panel-text" style="text-align: right;">
              拍卖中数据
            </div>
            <div style="text-align: center;margin-top: 40px;">
              <count-to
                :start-val="0"
                :end-val="list.first_up_product_num"
                :duration="3000"
                class="card-panel-num"
              />
              <div class="card-panel-text" style="margin-top: 20px;">
                商家首次上传商品数
              </div>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="12" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-description">
            <div class="card-panel-text" style="text-align: right;">
              拍卖中数据
            </div>
            <div style="text-align: center;margin-top: 30px;">
              <count-to
                :start-val="0"
                :end-val="list.distribution_product_num"
                :duration="3000"
                class="card-panel-num"
              />
              <div class="card-panel-text" style="margin-top: 20px;">
                分销商品数
              </div>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="12" class="card-panel-col">
        <div class="card-panel">
          <div
            class="card-panel-description"
            style="text-align: center;margin-top: 80px;"
          >
            <count-to
              :start-val="0"
              :end-val="list.upbeat_product_num"
              :duration="3200"
              class="card-panel-num"
            />
            <div class="card-panel-text" style="margin-top: 20px;">
              拍卖中商品数
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="12" class="card-panel-col">
        <div class="card-panel">
          <div
            class="card-panel-description"
            style="text-align: center;margin-top: 80px;"
          >
            <count-to
              :start-val="0"
              :end-val="list.lock_product_num"
              :duration="3600"
              class="card-panel-num"
            />
            <div class="card-panel-text" style="margin-top: 20px;">
              锁定中商品数
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="12" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-description">
            <div class="card-panel-text" style="text-align: right;">
              起拍价数据
            </div>
            <div style="text-align: center;margin-top: 40px;">
              <count-to
                :start-val="0"
                :end-val="list.upbeat_product_money"
                :duration="3000"
                class="card-panel-num"
              />
              <div class="card-panel-text" style="margin-top: 20px;">
                拍卖中商品价值
              </div>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="12" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-description">
            <div class="card-panel-text" style="text-align: right;">
              起拍价数据
            </div>
            <div style="text-align: center;margin-top: 40px;">
              <count-to
                :start-val="0"
                :end-val="list.lock_product_money"
                :duration="3000"
                class="card-panel-num"
              />
              <div class="card-panel-text" style="margin-top: 20px;">
                锁定中商品价值
              </div>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="24" class="card-panel-col">
        <div class="card-panel" style="text-align: center;height: 208px;">
          <div class="card-panel-description">
            <div style="margin-top: 70px;">
              <count-to
                :start-val="0"
                :end-val="list.total_money"
                :duration="3600"
                class="card-panel-num"
              />
            </div>
            <div class="card-panel-text" style="margin-top: 15px;">
              累计成交金额
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { getAuctionGoodPreview } from "@/api/common.js";
import CountTo from "vue-count-to";

export default {
  name: "auctionGoodPreview",
  components: {
    CountTo
  },
  data() {
    return {
      list: undefined
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      getAuctionGoodPreview().then(res => {
        this.list = res.data;
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 208px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.05);

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      font-weight: bold;
      margin: 26px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }
}
</style>
